# Copyright (C) 2009 Derek Bruening <iye@alum.mit.edu>
# http://www.burningcutlery.com/derek/bargraph/
# http://code.google.com/p/bargraphgen/

OUTDIR := ./encode
OUTDIR2 := ./decode_bit

BARGRAPH := ./bargraph.pl

SIZE := 700

SRCS := $(wildcard $(OUTDIR)/*.perf) $(wildcard $(OUTDIR2)/*.perf)
OBJS := $(patsubst %.perf,%.png,$(SRCS))

all: $(OBJS)

$(OUTDIR)/%.png: $(OUTDIR)/%.tiff
	mogrify -resize ${SIZE}x${SIZE} -format png $<

$(OUTDIR)/%.tiff: $(OUTDIR)/%.perf $(BARGRAPH)
	$(BARGRAPH) -fig $< | fig2dev -L tiff -m 4 > $@

$(OUTDIR)/%.eps: $(OUTDIR)/%.perf $(BARGRAPH)
	$(BARGRAPH) -eps $< > $@

$(OUTDIR2)/%.png: $(OUTDIR2)/%.tiff
	mogrify -resize ${SIZE}x${SIZE} -format png $<

$(OUTDIR2)/%.tiff: $(OUTDIR2)/%.perf $(BARGRAPH)
	$(BARGRAPH) -fig $< | fig2dev -L tiff -m 4 > $@

$(OUTDIR2)/%.eps: $(OUTDIR2)/%.perf $(BARGRAPH)
	$(BARGRAPH) -eps $< > $@

clean:
	-rm -f $(OBJS)
